  INSERT overwrite TABLE jms_dim.dim_cn_three_codes_change_dt PARTITION (dt='{{ execution_date | cst_ds_nodash }}')
      select
      a.id,
      a.staff_id,
      a.staff_code,
      a.staff_name,
      a.tail_code,
      a.tail_name,
      a.tail_type,
      a.tail_receive_coordinates,
      a.tail_dispatch_coordinates,
      a.tail_is_enable,
      a.tail_is_delete,
      a.tail_create_by,
      a.tail_update_by,
      a.tail_create_by_name,
      a.tail_update_by_name,
      a.tail_create_time,
      a.tail_update_time,
      a.tail_version,
      a.tail_sort,
      a.second_code_id,
      a.network_second_code,
      a.network_id,
      a.network_name,
      a.network_code,
      a.country_id,
      a.province_id,
      a.city_id,
      a.area_id,
      a.town_id,
      a.network_is_enable,
      a.network_is_delete,
      a.network_create_by,
      a.network_update_by,
      a.network_create_by_name,
      a.network_update_by_name,
      a.network_create_time,
      a.network_update_time,
      a.network_version,
      a.network_sort
      from
      (select
      id,
      staff_id,
      staff_code,
      staff_name,
      tail_code,
      tail_name,
      tail_type,
      tail_receive_coordinates,
      tail_dispatch_coordinates,
      tail_is_enable,
      tail_is_delete,
      tail_create_by,
      tail_update_by,
      tail_create_by_name,
      tail_update_by_name,
      tail_create_time,
      tail_update_time,
      tail_version,
      tail_sort,
      second_code_id,
      network_second_code,
      network_id,
      network_name,
      network_code,
      country_id,
      province_id,
      city_id,
      area_id,
      town_id,
      network_is_enable,
      network_is_delete,
      network_create_by,
      network_update_by,
      network_create_by_name,
      network_update_by_name,
      network_create_time,
      network_update_time,
      network_version,
      network_sort,
      concat_ws('-',cast(network_code as string),network_second_code) as flag_md5
      from jms_dim.dim_cn_three_codes_dt where dt='{{ execution_date | cst_ds_nodash }}') a
      left join
      (select
      id,
      staff_id,
      staff_code,
      staff_name,
      tail_code,
      tail_name,
      tail_type,
      tail_receive_coordinates,
      tail_dispatch_coordinates,
      tail_is_enable,
      tail_is_delete,
      tail_create_by,
      tail_update_by,
      tail_create_by_name,
      tail_update_by_name,
      tail_create_time,
      tail_update_time,
      tail_version,
      tail_sort,
      second_code_id,
      network_second_code,
      network_id,
      network_name,
      network_code,
      country_id,
      province_id,
      city_id,
      area_id,
      town_id,
      network_is_enable,
      network_is_delete,
      network_create_by,
      network_update_by,
      network_create_by_name,
      network_update_by_name,
      network_create_time,
      network_update_time,
      network_version,
      network_sort,
     concat_ws('-',cast(network_code as string),network_second_code) as flag_md5
      from jms_dim.dim_cn_three_codes_dt where dt='{{ execution_date | date_add(-1) | cst_ds_nodash }}') b
      on a.flag_md5=b.flag_md5
      where b.flag_md5 is null distribute by 1 ;